package com.suixun.service.mongodb;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import org.springframework.stereotype.Service;

import com.suixun.dao.mongodb.AudioCacheDao;
import com.suixun.entity.mongodb.AudioCache;
import com.suixun.util.db.MongoDBPagination;

@Service("audioCacheService")
public class AudioCacheService {

    @Resource
	private AudioCacheDao audioCacheDao;

	public AudioCache findByid(int id) {
		return audioCacheDao.findById(id);
	}

	public AudioCache findOne(Map<String, String> params) {
		return this.audioCacheDao.findOne(params);
	}
	
	public List<AudioCache> find(Query query) {
        return this.audioCacheDao.find(query);
    }
	
	public AudioCache save(AudioCache bean) {
		return audioCacheDao.save(bean);
	}

	public MongoDBPagination<AudioCache> getPageArticle(int pageNo, int pageSize) {
		return audioCacheDao.getPageArticle(pageNo, pageSize);
	}

	/**
	 * 暂时只是固定去修改,会有下一篇博客,写高级修改...
	 */
	public void update(String id, Map<String, String> params) {
		this.audioCacheDao.updateEntity(id, params);
	}
	
	public AudioCache findAndRemove(Query query) {
        return this.audioCacheDao.findAndRemove(query);
    }
	
	public AudioCache findAndModify(Query query, Update update) {

        return this.audioCacheDao.findAndModify(query, update);
    }
}
